package com.punch.common.enums.course;

/**
 * @author xiaol
 * @date 2020/7/21 15:53
 * 签到状态 0-初始 1-已到 2-请假 3-缺勤
 */

public enum SignInStatusEnum {
    INIT_STATUS(0, ""),
    HAS_BEEN_TO(1, "已到"),
    ASK_FOR_LEAVE(2, "请假"),
    ABSENTEEISM(3, "缺勤");

    SignInStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    private int code;
    private String name;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static String getName(Integer code) {
        if (code == null) {
            return "";
        }
        for (SignInStatusEnum roleEnum : SignInStatusEnum.values()) {
            if (roleEnum.getCode() == code) {
                return roleEnum.getName();
            }
        }
        return "";
    }
}

